/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package jpamodel;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Joseph
 */
@Entity
@Table(name = "Seller")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Seller.findAll", query = "SELECT s FROM Seller s"),
    @NamedQuery(name = "Seller.findBySellerID", query = "SELECT s FROM Seller s WHERE s.sellerID = :sellerID"),
    @NamedQuery(name = "Seller.findByName", query = "SELECT s FROM Seller s WHERE s.name = :name"),
    @NamedQuery(name = "Seller.findByPhone", query = "SELECT s FROM Seller s WHERE s.phone = :phone"),
    @NamedQuery(name = "Seller.findByMoney", query = "SELECT s FROM Seller s WHERE s.money = :money")})
public class Seller implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "seller_ID")
    private Integer sellerID;
    @Column(name = "name")
    private String name;
    @Column(name = "phone")
    private String phone;
    @Column(name = "money")
    private Integer money;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
    private List<CommissionWare> commissionWareList;

    public Seller() {
    }

    public Seller(Integer sellerID) {
        this.sellerID = sellerID;
    }

    public Integer getSellerID() {
        return sellerID;
    }

    public void setSellerID(Integer sellerID) {
        this.sellerID = sellerID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    @XmlTransient
    public List<CommissionWare> getCommissionWareList() {
        return commissionWareList;
    }

    public void setCommissionWareList(List<CommissionWare> commissionWareList) {
        this.commissionWareList = commissionWareList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sellerID != null ? sellerID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Seller)) {
            return false;
        }
        Seller other = (Seller) object;
        return !((this.sellerID == null && other.sellerID != null) || (this.sellerID != null && !this.sellerID.equals(other.sellerID)));
    }

    @Override
    public String toString() {
        return name;
    }
    
}
